<template>
  <div class="test"></div>
</template>

<script>
export default {
  data() {
    return {
      List: [
        {
          id: 1265960775284895700,
          name: "系统管理",
          parentId: 0,
          subList: {
            id: 1266177074908815400,
            name: "菜单管理",
            parentId: 1265960775284895700,
            subList: {
              id: 1266198004489949200,
              name: "订单管理",
              parentId: 1266177074908815400,
              subList: []
            }
          }
        }
      ]
    };
  },

  methods: {
    getId(obj){
      const ids = [];

      const current = obj;

      ids.push(current.id)

      while(current.subList){
        current = current.subList;
        ids.push(current.id)
      }

      return ids;
    }
  },
  
  mounted () {
    var abc = this.getId(this.List[0])

    console.log(abc);
  }
};
</script>

<style>
</style>